package com.example.http.sczw.controller;

import com.example.http.sczw.service.GetCookieInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

/**
 * @author zhouxl
 * @DATE 2021/8/31
 * @descriptoin
 */
@RestController
@RequestMapping("api/sczw")
public class GetCookieInfoController {

    @Autowired
    private GetCookieInfoService getCookieInfoService;

    @RequestMapping("getCookieInfo")
    public Object getCookieInfo(HttpServletRequest request){
        Cookie[] cookies = request.getCookies();
        for (Cookie cookie : cookies) {
            System.out.println(cookie.getName() +"="+cookie.getValue());
        }
        return "";
    }

    // 转发
    @RequestMapping("forwardSczwLoginInfo")
    public Object forwardSczwLoginInfo(HttpServletRequest request){
        return getCookieInfoService.forwardSczwLoginInfo(request);
    }


}
